/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EntityBeans;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author SOGOBA
 */
@Entity
@Table(name = "products", catalog = "ecom_db", schema = "")
@NamedQueries({
    @NamedQuery(name = "Products.findAll", query = "SELECT p FROM Products p"),
    @NamedQuery(name = "Products.findByReferenceProd", query = "SELECT p FROM Products p WHERE p.referenceProd = :referenceProd"),
    @NamedQuery(name = "Products.findByNameProd", query = "SELECT p FROM Products p WHERE p.nameProd = :nameProd"),
    @NamedQuery(name = "Products.findByPriceProd", query = "SELECT p FROM Products p WHERE p.priceProd = :priceProd")})
public class Products implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "reference_prod", nullable = false)
    private Integer referenceProd;
    @Column(name = "name_prod", length = 50)
    private String nameProd;
    @Column(name = "price_prod", precision = 22)
    private Double priceProd;
    @JoinColumn(name = "id_productsstore_fk", referencedColumnName = "reference_store")
    @ManyToOne
    private Productsstore productsstore;
    @JoinColumn(name = "id_category_fk", referencedColumnName = "id_category")
    @ManyToOne
    private Category category;

    public Products() {
    }

    public Products(Integer referenceProd) {
        this.referenceProd = referenceProd;
    }

    public Integer getReferenceProd() {
        return referenceProd;
    }

    public void setReferenceProd(Integer referenceProd) {
        this.referenceProd = referenceProd;
    }

    public String getNameProd() {
        return nameProd;
    }

    public void setNameProd(String nameProd) {
        this.nameProd = nameProd;
    }

    public Double getPriceProd() {
        return priceProd;
    }

    public void setPriceProd(Double priceProd) {
        this.priceProd = priceProd;
    }

    public Productsstore getProductsstore() {
        return productsstore;
    }

    public void setProductsstore(Productsstore productsstore) {
        this.productsstore = productsstore;
    }

    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (referenceProd != null ? referenceProd.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Products)) {
            return false;
        }
        Products other = (Products) object;
        if ((this.referenceProd == null && other.referenceProd != null) || (this.referenceProd != null && !this.referenceProd.equals(other.referenceProd))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "EntityBeans.Products[referenceProd=" + referenceProd + "]";
    }

}
